package service.impl;

import java.util.ArrayList;
import java.util.List;

import parser.JsonParser;
import parser.impl.AreaJsonParser;
import pojo.Area;
import dao.AreaDao;
import dao.impl.AreaDaoImpl;
import service.AreaTipsService;

public class AreaTipsServiceImpl implements AreaTipsService{

	private AreaDao dao  = new AreaDaoImpl();
	private JsonParser parser = new AreaJsonParser();
	
	@Override
	public String parseInputAndReturnOutput(String input) {
		List<Area> areaList = dao.findAll(input);
		if(areaList==null)
			areaList = new ArrayList<Area>();
		
		String resJson = parser.arrayToJson(areaList);
		System.out.println(resJson);
		return resJson;
	}

}
